package com.njwb.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Description: 类的描述
 * Author: yuandeyin@itany.com
 * Date: 2025-08-05 11:55
 * Version: 1.0
 */
public class TestFileInputStream02 {
    public static void main(String[] args) {
        InputStream in = null;
        try {
            in = new FileInputStream("src/com/njwb/io/hello.txt");
            //准备一个字节数组
            byte[] buffer = new byte[3];
            int len = in.read(buffer);
            while(len != -1){
                System.out.print(new String(buffer,0,len));
                len = in.read(buffer);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
